<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<title>第六天 数据驱动视图</title>
</head>
<body>
	<div id="app">
	</div>
	<script type="text/javascript" src="./node_modules/vue/dist/vue.js"></script>
	<script src="https://unpkg.com/axios/dist/axios.min.js"></script>
	<script type="text/javascript">
		Vue.prototype.$http = axios;

		let App={
			template:`<div>
						<button @click='sendAjax'>发起请求</button>
					  </div>`,
			methods:{
				sendAjax(){
					this.$http.get('http://www.baidu.com').then((res)=>{
						console.log('成功');
					}).catch((err)=>{
						console.log('失败');
					})
				}
			}
		};



		new Vue({
			el:'#app',
			data(){
				return{

				}
			},
			components:{
				App
			},
			template:`<App/>`
		})

	</script>
</body>
</html>
